package com.spzx.product.api.service;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.domain.R;
import com.spzx.product.api.domain.Product;
import com.spzx.product.api.domain.ProductDetails;
import com.spzx.product.api.domain.ProductSku;
import com.spzx.product.api.domain.vo.SkuPriceVo;
import com.spzx.product.api.domain.vo.SkuStockVo;
import com.spzx.product.api.factory.RemoteProductSkuFallbackFactory;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;
import java.util.Map;

@FeignClient(contextId = "RemoteProductService",value = "spzx-product" ,fallbackFactory = RemoteProductSkuFallbackFactory.class)
public interface RemoteProductSkuService {

    @GetMapping("/product/getTopProductSku")
    public R<List<ProductSku>> getTopProductSku(@RequestHeader(SecurityConstants.FROM_SOURCE)String source);

    @Operation(summary = "供微服务内部远程调用获取商品sku的接口")
    @GetMapping("/productSku/getProductSkuById/{skuId}")
    R<ProductSku> getProductSkuById(@PathVariable("skuId") Long skuId,@RequestHeader(SecurityConstants.FROM_SOURCE)String source);

    @Operation(summary = "供微服务内部远程调用获取商品信息的接口")
    @GetMapping("/productSku/getPrductById/{id}")
    R<Product> getProductById(@PathVariable("id") Long id,@RequestHeader(SecurityConstants.FROM_SOURCE)String source);


    @Operation(summary = "供微服务内部远程调用获取商品Sku价格的接口")
    @GetMapping("/productSku/getSkuPriceVoBySkuId/{skuId}")
    public R<SkuPriceVo> getSkuPriceVoBySkuId(@PathVariable("skuId") Long skuId,@RequestHeader(SecurityConstants.FROM_SOURCE)String source);

    @Operation(summary = "获取商品详细信息")
    @GetMapping(value = "/productSku/getProductDetails/{id}")
    public R<ProductDetails> getProductDetails(@PathVariable("id") Long id,@RequestHeader(SecurityConstants.FROM_SOURCE)String source);

    @Operation(summary = "获取商品sku规则详细信息")
    @GetMapping(value = "/productSku/getSkuSpecValue/{id}")
    R<Map<String, Long>> getSkuSpecValue(@PathVariable("id") Long id,@RequestHeader(SecurityConstants.FROM_SOURCE)String source);

    @Operation(summary = "获取商品sku库存信息")
    @GetMapping(value = "/productSku/getSkuStock/{skuId}")
    R<SkuStockVo> getSkuStock(@PathVariable("skuId") Long skuId,@RequestHeader(SecurityConstants.FROM_SOURCE)String source);


}
